import java.io.ObjectOutputStream;
/*
* 懒汉模式
* */
class SingletonLazy{
    private void SingletonLazy(){
    }
    private static SingletonLazy singletonLazy= null;
    private static Object object=new Object();
    public static SingletonLazy getSingletonLazy() {
        if(singletonLazy==null){
            synchronized (object){
                if(singletonLazy==null){
                    singletonLazy=new SingletonLazy();
                }
            }
        }
        return singletonLazy;
    }
}
public class demon2 {
    public static void main(String[] args) {
        SingletonLazy s1=SingletonLazy.getSingletonLazy();
        SingletonLazy s2=SingletonLazy.getSingletonLazy();
        System.out.println(s1==s2);
    }
}
